<template>
  <fieldset>
    <legend>兄弟组件</legend>
    <h1>{{ msg }}</h1>
    <button @click="send">点击发送给Child</button>
  </fieldset>
</template>
<script>
export default {
  data() {
    return {
      msg: "是兄弟就来砍我",
    };
  },
  methods: {
    send() {
      this.$bus.$emit("getBro", "Bro传递的话：" + this.msg);
    },
  },
  mounted() {
    this.$bus.$on("toBro", (input) => {
      console.log(input);
      this.msg = input;
      this.$bus.$off("toBro");
    });
  },
};
</script>
